const Mock = require('mockjs')
// 数据面板
const overview = Mock.mock({
  admin_user: '@integer(4,20)',
  teacher_user: '@integer(30,60)',
  subject_num: '@integer(15,40)',
  class_num: '@integer(10,30)'
})

// 地图
const mapData = Mock.mock({
  'list|27': [{
    'name|+1': ['北京', '重庆', '湖北', '四川', '陕西', '江苏', '湖南', '福建', '江西', '黑龙江', '天津', '西藏',
      '云南', '甘肃', '新疆', '广西', '河北', '青海', '安徽', '吉林', '河南', '山东', '贵州', '浙江', '内蒙古', '宁夏', '上海'],
    'value': '@integer(1,20)'
  }]
})
// 折线
const lineData = Mock.mock({
  'list|3': [
    {
      'name|4': ['@cname'],
      'value1|4': ['@integer(1,100)'],
      'value2|4': ['@integer(1,100)']
    }
  ]
})

// 雷达
const radarData = Mock.mock({
  'list|3': [
    {
      'name1': '@cname',
      'name2': '@cname',
      'value1|5': ['@integer(-100,2000)'],
      'value2|5': ['@integer(-100,2000)']
    }
  ]
})

// 柱状图
const barData = Mock.mock({
  'list|7': [() => Mock.Random.integer(50, 200)]
})

// 饼图
const pieData = Mock.mock({
  'list|3': [
    {
      'name': '@cname',
      'value': '@integer(100,1500)'
    }
  ]
})
// 玫瑰图
const roseData = Mock.mock({
  'list|4': [
    {
      'name': '@cname',
      'value': '@integer(20,500)'
    }
  ]
})

module.exports = [
  // 数据面板接口
  {
    url: '/mock/dashboard/overview',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: overview }
    }
  },
  // 地图接口
  {
    url: '/mock/dashboard/map',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: mapData.list }
    }
  },
  // 折线图接口
  {
    url: '/mock/dashboard/line',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: lineData.list }
    }
  },
  // 雷达图接口
  {
    url: '/mock/dashboard/radar',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: radarData.list }
    }
  },
  // 饼图接口
  {
    url: '/mock/dashboard/pie',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: pieData.list }
    }
  },
  // 柱状图接口
  {
    url: '/mock/dashboard/bar',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: barData.list }
    }
  },
  // 玫瑰图
  {
    url: '/mock/dashboard/rose',
    type: 'get',
    response: config => {
      return { success: true, message: '', data: roseData.list }
    }
  }
]

